<template>
  <div class="dialog" v-if="user">
    <span>头像昵称</span>
    <div class="avartar">
      <img :src="getAvartar(user.userProfileUrl)" alt="">
      <div>
        <el-avatar :src="getAvartar(user.userProfileUrl)"></el-avatar>
      </div>

      <div class="info">
        <span class="username">{{ user.userNickname || `用户${user.userId}` }}</span>
        <span class="introduce">{{ user.userIntroduce || "这个人太懒，什么也没留下" }}</span>
      </div>
    </div>

    <span>个人资料</span>
    <div class="group">
      <div class="item">
        <i class="icon icon-yonghu4 purple-icon"></i>
        <span class="title">名字</span>
        <span class="right-info">{{ user.userRealname || '未填写' }}</span>
        <i class="el-icon-arrow-right"></i>
      </div>
      <div class="item">
        <i class="icon icon-wode green-icon"></i>
        <span class="title">性别</span>
        <i class="el-icon-arrow-right"></i>
        <span class="right-info">{{ user.userGender || '未知' }}</span>
      </div>
      <div class="item">
        <i class="icon icon-dianhua red-icon"></i>
        <span class="title">电话</span>
        <i class="el-icon-arrow-right"></i>
        <span class="right-info">{{ user.userPhone || '未填写电话' }}</span>
      </div>
      <div class="item">
        <i class="icon icon-youxiang5 purple-icon"></i>
        <span class="title">邮箱</span>
        <i class="el-icon-arrow-right"></i>
        <span class="right-info">{{ user.userEmail || '未填写邮箱' }}</span>
      </div>
      <div class="item">
        <i class="icon icon-shijian7 green-icon"></i>
        <span class="title">生日</span>
        <i class="el-icon-arrow-right"></i>
        <span class="right-info">{{ user.userBirthday || '未填写生日' }}</span>
      </div>
    </div>
  </div>
</template>

<script>

import { getAvartar } from '@/utils/tools';
export default {
  props: {
    user: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  name: 'showUserItem',
  data() {
    return {
    }
  },
  methods: {
    getAvartar,
  }
}
</script>
<style scoped lang="less">
.dialog {
  width: 100%;
  height: 100%;

}



.avartar {
  width: 100%;
  margin: 5px 0 20px -10px;
  display: flex;
  height: 140px;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 0;


  img {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    object-fit: cover;
    filter: blur(8px);
    /* 确保 img 在最下面 */
  }

  /* 确保 .el-upload 在 img 之上 */
  .el-avatar {
    position: relative;
    margin-top: 10px;
    height: 70px;
    width: 70px;
    align-items: center;
    z-index: 10;
    border: 2px solid #c8c1c1;
  }


  .info {
    width: 80%;
    display: flex;
    flex-direction: column;
    z-index: 2;
    position: relative;

    .username {
      font-size: 18px;
      font-weight: 700;
      margin-bottom: 3px;
      text-align: center;
      color: #ffffff;
      text-shadow: 1px 2px #272626;
      /* 白色文字 */
      mix-blend-mode: difference;
    }

    .introduce {
      font-size: 12px;
      text-align: center;
      color: #ffffff;
      text-shadow: 1px 2px #5f5858;
      /* 白色文字 */
      mix-blend-mode: difference;
    }
  }

}

.purple-icon {
  color: #503E9D;
  background-color: #e9e8ee;
}

.green-icon {
  color: #FACD5D;
  background-color: #FEFAEE;
}

.red-icon {
  color: #FB7545;
  background-color: #FFF0EB;
}

.group {
  width: 100%;
  margin: 10px 0 0 -10px;

  .item {
    font-weight: 400;
    color: #666666;
    display: flex;
    align-items: center;
    height: 32px;
    position: relative;
    font-size: 14px;
    padding: 0 5px;
    cursor: pointer;
    margin-bottom: 15px;
    border-radius: 10px;
    border: 1px solid #ffffff;
    overflow: hidden;

    .right-info {
      padding: 0 10px 0 0;
      line-height: 32px;
      color: #000000;
      position: absolute;
      text-align: right;
      right: 15px;
    }

    i {
      height: 32px;
      width: 32px;
      text-align: center;
      line-height: 32px;
      margin-right: 10px;
      font-size: 20px;
    }

    i:first-of-type {
      border-radius: 5px;
    }

    i:last-of-type {
      position: absolute;
      margin-right: -10px;
      right: 0;
      z-index: 10;
    }

    /* 清除浮动 */
    .clearfix::after {
      content: "";
      display: table;
      clear: both;
    }
  }
}
</style>
